<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>学期教材详情</title>
    <link rel="stylesheet" href="/element-ui/index.css">
    <link rel="stylesheet" href="/element-ui/fonts/element-icons.css">
    <script src="/element-ui/vue.js"></script>
    <script src="/element-ui/index.js"></script>
    <script src="/element-ui/axios.min.js"></script>
    <style>
        body { font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '\5FAE\8F6F\96C5\9ED1', Arial, sans-serif; background-color: #f5f6fa; }
        #app { padding: 20px; background-color: #f5f6fa; }
        .page-title { font-size: 26px; font-weight: bold; color: #333; background: #fff; padding: 24px 20px 12px 20px; border-bottom: 1px solid #eee; margin-bottom: 20px; letter-spacing: 2px; text-align: center; animation: fadeInDown 0.8s ease-out; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-radius: 8px; }
        @keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
        .el-main { padding: 20px; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
        .el-button { transition: all 0.3s ease; }
        .el-button:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
        .el-descriptions-item__label { font-weight: bold; color: #606266; }
        .el-descriptions-item__content { color: #303133; }
        .el-descriptions { animation: fadeIn 1s ease-out; }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    </style>
</head>
<body>
    <div class="page-title">学期教材详情</div>
    <div id="app">
        <el-container>
            <el-main>
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <span>学期教材基本信息</span>
                    </div>
                    <el-descriptions :column="1" border>
                        <el-descriptions-item label="ID">{{ termBook.id }}</el-descriptions-item>
                        <el-descriptions-item label="教材ID">{{ termBook.bookId }}</el-descriptions-item>
                        <el-descriptions-item label="教材名称">{{ termBook.bookName }}</el-descriptions-item>
                        <el-descriptions-item label="学期">{{ termBook.term }}</el-descriptions-item>
                        <el-descriptions-item label="专业">{{ termBook.major }}</el-descriptions-item>
                        <el-descriptions-item label="创建时间">{{ termBook.createTime }}</el-descriptions-item>
                    </el-descriptions>
                </el-card>
                <div style="margin-top: 30px; text-align: center;">
                    <el-button @click="goBack">返回</el-button>
                </div>
            </el-main>
        </el-container>
    </div>
    <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    termBook: { id: '', bookId: '', bookName: '', term: '', major: '', createTime: '' }
                }
            },
            created() {
                // 从URL路径中提取ID
                const pathSegments = window.location.pathname.split('/');
                const id = pathSegments[pathSegments.length - 1];
                if (id && !isNaN(id)) {
                    this.fetchDetail(id);
                }
            },
            methods: {
                fetchDetail(id) {
                    axios.get(`/termbook/api/detail/${id}`)
                        .then(response => {
                            this.termBook = response.data;
                        })
                        .catch(error => {
                            console.error('Error fetching detail:', error);
                            this.$message.error('获取详情失败');
                        });
                },
                goBack() { window.location.href = '/termbook/list'; }
            }
        });
    </script>
</body>
</html> 